/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __A2E0ECAA_8AAF_4A02_9AAF_35B7FF9A2867__
#define __A2E0ECAA_8AAF_4A02_9AAF_35B7FF9A2867__

// DRIVER={MySQL ODBC 5.3 ANSI Driver};SERVER=192.168.80.131;PORT=3306;DATABASE=javadb;UID=root;PWD=root;CharSet=UTF8;

namespace xos_odbc
{
    class i_recordset;

    /////////////////////////////////////////////////////////////////////////////////
    // 
    // 数连接接口
    // 
    class i_connect : public xos::i_release
    {
    protected:
        virtual ~i_connect(){}

    public:
        // 
        // 利用不同数据库的功能生成对应sql放在lpszSql中，得到最后新增记录的自增ID。
        // 成功返回0,结果在lpIntId中
        // 
        virtual int get_last_insert_id( const char * lpszSql, int * lpIntId ) = 0;

        // 
        // 生成i_recordset
        // 
        virtual i_recordset * recordset( i_recordset ** ppv ) = 0;

        // 
        //  0 : success. 
        //  1 : running. 
        // -1 : failed
        // 
		virtual int end_trans( bool bCommit ) = 0;

        // 
        //  0 : success. 
        //  1 : running. 
        // -1 : failed
        // 
		virtual int begin_trans() = 0;

        // 
        //  0 : success. 
        //  1 : running. 
        // -1 : failed
        // 
        virtual int connect() = 0;
    };

} // xos_odbc

#endif // __A2E0ECAA_8AAF_4A02_9AAF_35B7FF9A2867__
